<?php


namespace RedMVC\CodeGenerator;
use RedMVC;

/**
 * PhpClassMethod class
 *
 * @category    RedMVC
 * @package     CodeGenerator
 * @author      Jan Fischer, bitWorking <info@bitworking.de>
 */
class PhpClassMethod{

    protected $_viewScript;

    protected $_visibility;
    protected $_name;
    protected $_args = array();
    protected $_body;

    public function __construct($visibility = null, $name = null, $args = array(), $body = null){
        $this->setVisibility($visibility);
        $this->setName($name);
        $this->_args = $args;
        $this->setBody($body);
        $this->_viewScript = LIB_PATH.DS.'RedMVC'.DS.'CodeGenerator'.DS.'views'.DS.'phpClassMethod.phtml';
    }

    public function setVisibility($visibility){
        $this->_visibility = $visibility;
    }

    public function setName($name){
        $this->_name = $name;
    }

    public function addArg($arg){
        $this->_args[] = $arg;
    }

    public function setBody($body){
        $this->_body = $body;
    }

    public function render(){
        ob_start();
        include($this->_viewScript);
        return ob_get_clean();
    }

}